package com.chenfubing.ps.controller;


import com.chenfubing.ps.entity.Charges;
import com.chenfubing.ps.entity.result.JsonResult;
import com.chenfubing.ps.service.IChargesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author chenfubing
 * @since 2020-05-05
 */
@RestController
@RequestMapping("/charges")
public class ChargesController {

    @Autowired
    private IChargesService iChargesService;

    /**
     * 获取费率表
     * @return
     */
    @GetMapping("/getChargesList")
   public JsonResult getChargesList(){
return new JsonResult(iChargesService.getChargesList());
   }

    /**
     * 更新费率
     *
     * 传参费率id和费率价格
     * @param charges @id @chargesMoney
     */
    @PostMapping("/updateCharges")
    public JsonResult updateCharges(@RequestBody Charges charges){
        iChargesService.updateCharges(charges);
        return new JsonResult();
    }

}
